package DynamicProgramming;

/**
 * @author: Darven
 * @createTime: 2025-08-01  03:36
 * @description: 300. 最长递增子序列
 */
public class P300 {
    public static void main(String[] args) {
        P300Demo p300Demo = new P300Demo();
        System.out.println(p300Demo.lengthOfLIS(new int[]{1,3,6,7,9,4,10,5,6}));
    }
}

class P300Demo{
    public int lengthOfLIS(int[] nums) {
        if(nums.length==0){
            return 0;
        }
        int[] dp=new int[nums.length];
        dp[0]=1;
        int maxNums=1;
        for(int i=1;i<nums.length;i++){
            dp[i]=1;
            for(int j=0;j<i;j++){
                if(nums[i]>nums[j]){
                    dp[i]=Math.max(dp[i],dp[j]+1);
                }
            }
            maxNums=Math.max(maxNums, dp[i]);
        }

        return maxNums;
    }
}
